package com.jiajia;

/**
 *
 * 在各个jdk版本中结果是不一样的
 *
 *      jdk6
 *      jdk7
 *      jdk8
 * @author : zjj
 * @date : 2022/4/24 10:34
 */
public class Demo08Intern {

    public static void main(String[] args) {
        test1();
        test2();
    }

    public static void test1(){
        String str = new String("a") + new String("b");
        str.intern();
        String str2 = "ab";
        System.out.println(str == str2);

    }
    public static void test2(){
        String str = new String("a") + new String("b");
        String str2 = "ab";
        str.intern();
        System.out.println(str == str2);
    }
}
